import http from "@/api";
import { ResPage } from "../interface";
import { Work } from "../interface/work";

export const getWorkListApi = (pageNum: number = 1, pageSize: number = 10, wrapper?: Partial<Work>) => {
	return http.post<ResPage<Work>>(`/work/getList/${pageNum}/${pageSize}`, { wrapper });
};

export const getWorkDetailApi = (id: number) => {
	return http.get<Work>(`/work/getDetail/${id}`);
};

export const addWorkApi = (leaveWord: Work) => {
	return http.post<string>(`/work/create`, leaveWord);
};

export const deleteWorkApi = (id: number) => {
	return http.delete<string>(`/work/delete/${id}`);
};

export const updateWorkApi = (work: Partial<Work>) => {
	return http.post<string>(`/work/update`, work);
};
